package com.iqik.rmi.intfs_impl;

import com.iqik.rmi.intfs.IHelloService;
import com.iqik.rmi.pojo.User;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class HelloServiceImpl extends UnicastRemoteObject implements IHelloService {

    /**
     * 手动实现父类构造方法
     * @throws RemoteException
     */
    public HelloServiceImpl() throws RemoteException {
        super();
    }

    @Override
    public String sayHello(User user) throws RemoteException {
        System.out.println("this is server, say hello to " + user.getName());
        return String.format("Hello %s", user.getName());
    }
}
